package com.acwing.partition4;

import java.io.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author `RKC`
 * @date 2021/12/19 14:40
 */
public class AC327玉米田 {

    private static final int N = 15, M = 15, mod = (int) 1e8;
    private static int[] graph = new int[N];
    //f[i][j]表示考虑前i行，当前行的状态是j的情况下的总方案数
    private static int[][] f = new int[N][1 << M];
    private static Map<Integer, List<Integer>> stm = new HashMap<>();

    private static int n = 0, m = 0;

    private static final BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
    private static final BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(System.out));

    public static void main(String[] args) throws IOException {
        String[] ss = reader.readLine().split(" ");
        n = Integer.parseInt(ss[0]);
        m = Integer.parseInt(ss[1]);
        for (int i = 0; i < n; i++) {
            ss = reader.readLine().split(" ");
            for (int j = 0; j < m; j++) graph[i] |= (Integer.parseInt(ss[j]) == 0 ? 1 : 0) << j;
        }
        writer.write(resolve() + "\n");
        writer.flush();
    }

    private static int resolve() {
        //首先单行自己不能有相邻的
        for (int i = 0; i < 1 << m; i++) {
            if ((i & (i << 1)) == 0) stm.put(i, new ArrayList<>());
        }
        //在当前行合法的基础上，枚举上一行的合法状态
        for (Map.Entry<Integer, List<Integer>> entry : stm.entrySet()) {
            int cur = entry.getKey();
            List<Integer> stv = entry.getValue();
            for (int pre : stm.keySet()) {
                if ((cur & pre) == 0) stv.add(pre);
            }
        }
        f[0][0] = 1;
        for (int i = 1; i <= n + 1; i++) {
            for (Map.Entry<Integer, List<Integer>> entry : stm.entrySet()) {
                int cur = entry.getKey();
                f[i][cur] = 0;
                if ((cur & graph[i - 1]) == 0) {
                    for (int pre : entry.getValue()) {
                        f[i & 1][cur] = (f[i & 1][cur] + f[i - 1 & 1][pre]) % mod;
                    }
                }
            }
        }
        return f[n + 1 & 1][0];
    }
}
